package com.cxl.price.action.price;
import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.ParentPackage;

import com.cxl.price.bean.Goods;
import com.cxl.price.bean.OtherShopPrice;
import com.cxl.price.service.GoodsService;
import com.cxl.price.service.OtherShopPriceService;
import com.cxl.price.top.service.TopItemResponseService;
import com.summer.core.action.BaseAction;
import com.taobao.api.ApiException;
import com.taobao.api.domain.Item;

/**
 * @about: 其他商城价格 action
 * @author: wwwlike
 * @create: 2011-08-25
 */
 
 
@ParentPackage("price")			
public class OtherShopPriceAction extends BaseAction<OtherShopPrice, OtherShopPriceService> {

	private GoodsService goodsService; 
	private TopItemResponseService topItemResponseService;
	
	public void setOtherShopPrice(OtherShopPrice otherShopPrice) {
		setBean(otherShopPrice);
	}

	public OtherShopPrice getOtherShopPrice() {
		return getBean();
	}

	@Resource
	public void setService(OtherShopPriceService service) {
		this.service = service;
	}
	
	
	@Resource
	public void setTopItemResponseService(
			TopItemResponseService topItemResponseService) {
		this.topItemResponseService = topItemResponseService;
	}

	@Resource
	public void setGoodsService(GoodsService goodsService) {
		this.goodsService = goodsService;
	}
	
	

	//搜索热门商品
	public String searchGoods() throws ApiException
	{
		Goods goods=null;
//	//	ItemsSearchRequest def=new ItemsSearchRequest();
////		if(ids!=null)
////		{
////			for(String id:ids)
////			{
//				goods=goodsService.get(id);
//				def.setProductId(goods.getProduct_id());
//				List<Item> listItem=topItemResponseService.getItemsSearchResponse(def).getItemSearch().getItems();
//				
//				OtherShopPrice one=null;
//				for(Item item:listItem)
//				{
//					one=service.get("num_iid",item.getNumIid());
//					if(one==null)
//					one=new OtherShopPrice();
//					one.setNicks(item.getNick());
//					one.setDetail_url(item.getDetailUrl());
//					one.setGoods(goods);
//					one.setTitle(item.getTitle());
//					one.setNum_iid(item.getNumIid());
//					one.setVolume(item.getVolume());
//					one.setPic_url(item.getPicUrl());
//					one.setPrice(item.getPrice());
//					one.setTitle(item.getTitle());
//					one.setExpress_fee(item.getExpressFee());
//					//freight_payer 	String 	否 	seller 	运费承担方式,seller（卖家承担），buyer(买家承担）
//					one.setFreight_payer(item.getFreightPayer());
//					
//					
//					if(one.getId()==null)
//						service.save(one);
//					else
//						service.update(one);
//				}
//				
////			}
////			
////		}
//		
//				redirectionUrl ="goods!list.action";
			return SUCCESS;
	}
	

	
	

}
